const source = require('../sources/a.json')
const { downloadSearch, parseSearch } = require('../modules/search')
const GBK = require('gbk.js')

downloadSearch(source, '灵剑山').then(res => {
  // const search = parseSearch(source, res)
  require('fs').writeFile(__dirname + '/../temp/search.html', res, function (err) {
    // const search = parseSearch(source, res)
  })
  const search = parseSearch(source, res)
  require('fs').writeFile(__dirname + '/../temp/search.json', JSON.stringify(search), function (err) {

  })
}).catch(err => {
  console.log(err)
})

// require('fs').readFile(__dirname + '/../temp/search.html', function (err, data) {
//   const search = parseSearch(source, data.toString())
//   console.log(search)
// })
